﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Security.Permissions;
using System.Security;
using TestLink2Net.Security;

namespace TestLink2Net.Entities
{
    public class RightAttribute : CodeAccessSecurityAttribute
    {
        private String _userName;
        private String _rightName;
        private Boolean _authenticated;

        public RightAttribute(SecurityAction action)
            : base(action)
        {
            _authenticated = true;
            _userName = String.Empty;
            _rightName = String.Empty;
        }
        public Boolean Authenticated
        {
            get { return _authenticated; }
            set { _authenticated = value; }
        }

        public String RightName
        {
            get { return _rightName; }
            set { _rightName = value; }
        }

        public String UserName
        {
            get { return _userName; }
            set { _userName = value; }
        }

        public override IPermission CreatePermission()
        {
            return new RightPermission(this._authenticated, this._userName, this._rightName);
        }
    }

}
